Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nitCC: add examples in case of conflicts #2842

Merged
merged 8 commits into from
Jul 21, 2024
Merged

Conversation

privat
Copy link
Member

@privat privat commented Jul 18, 2024

Add example of possible prefix (past) and suffix (future) in case of conflict shift/reduce or reduce/reduce.

Example:

SHIFT/REDUCE Conflict on state 3 'a' for token 'b':
A possible past: ['a']
SHIFT on item: x::x_1=.'b'
A possible future: ['b',Eof]
_start
├╴e
│ ├╴'a'
│ └╴x
│   └╴'b'
└╴Eof

REDUCE on item: x::x_0= 'a'.
A possible future: ['b',Eof]
_start
├╴e
│ ├╴x
│ │ └╴'a'
│ └╴'b'
└╴Eof

AMBIGUITY detected: same elements, different trees

This should help the user to contextualize some conflicts and enable them to fix their grammar.

Copy link

github-actions bot commented Jul 18, 2024

Test Results

    66 files     313 suites   16m 3s ⏱️
14 174 tests 13 633 ✅ 541 💤 0 ❌
14 229 runs  13 673 ✅ 556 💤 0 ❌

Results for commit a45fd3d.

♻️ This comment has been updated with latest results.

@privat privat force-pushed the nitcc-examples branch 2 times, most recently from 9f13bfd to a0f93d9 Compare July 19, 2024 14:03
@privat privat merged commit 0dcfe3a into nitlang:master Jul 21, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant